package com.wlgc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wlgc.dao.CourseDao;
import com.wlgc.entity.Course;
import com.wlgc.entity.RestBean;
import com.wlgc.mapper.CourseMapper;
import com.wlgc.service.CourseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CourseServiceImpl implements CourseService {
    LambdaQueryWrapper<Course> wrapper;
    @Resource
    CourseDao dao;
    @Resource
    CourseMapper courseMapper;
    public List<String> getAllCourse(){
        return courseMapper.getAllCourse();
    }
    public String getCid(String name){
        wrapper=new LambdaQueryWrapper<>();
        wrapper.eq(Course::getName,name);
        return dao.selectOne(wrapper).getCid().toString();
    }
    public List<String> getCourseByStudent(int sid){
        return courseMapper.getCourseBySid(sid);
    }

    @Override
    public List<String> getCourseByClass(int cno) {
        return courseMapper.getCourseByClass(cno);
    }
}
